/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package tcc.ejb.autenticador.entidade;

import java.io.Serializable;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;


/**
 *
 * @author Maciel
 */
@Entity
@Table(name = "aplicacao", catalog = "macielqs", schema = "autenticacao")
@NamedQueries({
    @NamedQuery(name = "Aplicacao.findAll", query = "SELECT a FROM Aplicacao a"),
    @NamedQuery(name = "Aplicacao.findById", query = "SELECT a FROM Aplicacao a WHERE a.id = :id"),
    @NamedQuery(name = "Aplicacao.findByNumero", query = "SELECT a FROM Aplicacao a WHERE a.numero = :numero")})
public class Aplicacao implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy=GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "id", nullable = false)
    private Integer id;
    @Basic(optional = false)
    @Column(name = "numero", nullable = false)
    private int numero;
    @JoinColumn(name = "profissional_id", referencedColumnName = "id", nullable = false)
    @ManyToOne(optional = false)
    private Profissional profissional;

    public Aplicacao() {
    }

    public Aplicacao(Integer id) {
        this.id = id;
    }

    public Aplicacao(Integer id, int numero) {
        this.id = id;
        this.numero = numero;
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public int getNumero() {
        return numero;
    }

    public void setNumero(int numero) {
        this.numero = numero;
    }

    public Profissional getProfissional() {
        return profissional;
    }

    public void setProfissional(Profissional profissional) {
        this.profissional = profissional;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (id != null ? id.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Aplicacao)) {
            return false;
        }
        Aplicacao other = (Aplicacao) object;
        if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "tcc.ejb.autenticador.entidade.Aplicacao[id=" + id + "]";
    }

}
